<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>

<body>
  <script>
    // for in   性能一般
    //可以循环数组和对象

    // var arr = ["星期三", "星期四", "星期五", "星期六"];
    // for (var x in arr) {
    //   // x ---代表下标
    //   document.write(arr[x] + "<br/>")
    // }

    // 对象数据类型  是由键(key)值(value)对构成
    var obj = {
      name: "小赵",
      age: 18,
      sex: "女"
    }
    console.log(obj.age)
    console.log(obj["age"])
    for (var x in obj) {
      // x---代表key
      document.write(x + "-----" + obj[x] + "<br/>")
    }
  </script>
</body>

</html>